package cn.njyd.corejava.thread.myday02;

public class InterruptMethodTest01 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(()->{
           while(true) {
               if(Thread.currentThread().isInterrupted()) {
                   break;
               }
               System.out.println(Thread.currentThread().getName()+"正在运行");
           }
        });

        t1.start();
        Thread.sleep(2000);

        t1.interrupted();

    }
}
